Problem: We are given a permutation sequence a1, a2, ..., an of numbers from 1 to n. Let's assume that in one second, we can choose some disjoint pairs (u1, v1), (u2, v2), ..., (uk, vk) and swap all aui and avi for every i at the same time (1 ≤ ui < vi ≤ n). The pairs are disjoint if every ui and vj are different from each other.

We want to sort the sequence completely in increasing order as fast as possible. Given the initial permutation, calculate the number of ways to achieve this. Two ways are different if and only if there is a time t, such that the set of pairs used for swapping at that time are different as sets (so ordering of pairs doesn't matter). If the given permutation is already sorted, it takes no time to sort, so the number of ways to sort it is 1.

To make the problem more interesting, we have k holes inside the permutation. So exactly k numbers of a1, a2, ..., an are not yet determined. For every possibility of filling the holes, calculate the number of ways, and print the total sum of these values modulo 1000000007 (109 + 7).

Input

The first line contains two integers n (1 ≤ n ≤ 105) and k (0 ≤ k ≤ 12). The second line contains the permutation sequence a1, ..., an (0 ≤ ai ≤ n). If a number is not yet determined, it is denoted as 0. There are exactly k zeroes. All the numbers ai that aren't equal to zero are distinct.

Output

Print the total sum of the number of ways modulo 1000000007 (109 + 7).

Examples

Input

5 0
1 5 2 4 3


Output

6


Input

5 2
1 0 2 4 0


Output

7

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[100010];
int ind[100010];
vector<int> f[100010], inv[100010];
int lcnt[100010];
int ccnt[100010];
int cc = 0, cl[100010];
int sl[1 << 13], bitcnt[1 << 13];
bool vis[100010];
void dfs(int p, int c) {
  vis[p] = true;
  ++c;
  if (a[p] == 0)
    ++lcnt[c], ++cc, cl[cc] = c;
  else if (vis[a[p]])
    ++ccnt[c];
  else
    dfs(a[p], c);
  return;
}
int power(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) res = 1ll * res * a % 1000000007;
    a = 1ll * a * a % 1000000007;
    b = b >> 1;
  }
  return res;
}
int ans;
int rans = 0;
int fac[100010];
void solve(int st, int mxl) {
  if (st == 0) {
    if (mxl == 1) ans = 1;
    if (mxl == 2) ans = 1;
    rans = (rans + ans) % 1000000007;
    return;
  }
  int lowbit = st & (-st);
  for (int i = st; i != 0; i = (i - 1) & st) {
    if (!(i & lowbit)) continue;
    int v = sl[i], tans = ans;
    ans = 1ll * ans * inv[v][ccnt[v]] % 1000000007;
    ++ccnt[v];
    ans = 1ll * ans * f[v][ccnt[v]] % 1000000007 * fac[bitcnt[i] - 1] %
          1000000007;
    solve(st ^ i, max(mxl, v));
    ans = tans;
    --ccnt[v];
  }
  return;
}
int main() {
  scanf("%d%d", &n, &k);
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = 1ll * fac[i - 1] * i % 1000000007;
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), ++ind[a[i]];
  for (int i = 1; i <= n; ++i) {
    f[i].push_back(1);
    inv[i].push_back(1);
    f[i].push_back(i);
    inv[i].push_back(power(i, 1000000007 - 2));
    for (int j = 2; j <= n / i; ++j) {
      f[i].push_back(
          (1ll * i * f[i][j - 1] % 1000000007 +
           1ll * i * (j - 1) % 1000000007 * f[i][j - 2] % 1000000007) %
          1000000007);
      inv[i].push_back(power(f[i][j], 1000000007 - 2));
    }
  }
  for (int i = 1; i <= n; ++i)
    if (ind[i] == 0) dfs(i, 0);
  for (int i = 1; i <= n; ++i)
    if (!vis[i]) dfs(i, 0);
  int tot = (1 << cc) - 1;
  int mxl = 0;
  for (int i = 1; i <= n; ++i)
    if (ccnt[i]) mxl = i;
  for (int i = 1; i <= tot; ++i) {
    bitcnt[i] = bitcnt[i >> 1] + (i & 1);
    for (int j = 1; j <= cc; ++j)
      if ((i >> (j - 1)) & 1) sl[i] += cl[j];
  }
  ans = 1;
  for (int i = 1; i <= n; ++i) ans = 1ll * ans * f[i][ccnt[i]] % 1000000007;
  solve(tot, mxl);
  cout << rans << endl;
  return 0;
}