{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Description","value":{"format":"PLAIN","content":" 你有一个长度为n的数列a和一个含有k个不同整数的集合b,b中的数都在[1,n]内。\n 现在你可以进行一些操作,每次操作中你可以选择两个数i和x,并将x赋值给ai。其中1\u003c\u003di\u003c\u003dn,但i不能出现在集合b中,而x可为任意整数。\n 求出将数列a变为严格上升序列的最小操作次数。 "}},{"title":"Input","value":{"format":"PLAIN","content":"第一行两个整数n,k(1\u003c\u003dn\u003c\u003d5e5,0\u003c\u003dk\u003c\u003dn),分别表示数列a的长度和集合b的大小。\n第二行n个整数,表示数列a,第三行k个整数,表示集合b。"}},{"title":"Output","value":{"format":"PLAIN","content":"输出一个整数表示答案。如果无法将数列a变为严格上升序列,输出-1。"}},{"title":"Examples","value":{"format":"PLAIN","content":"Input\n7 2\n1 2 1 1 3 5 1\n3 5\nOutput\n4\n\nInput\n3 3\n1 3 2\n1 2 3\nOutput\n-1"}}]}