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
#include <bits/stdc++.h>
const int N = 100000 + 10, MOD = 1000000007;
int n, k, a[N], ans;
int anc[N], size[N];
inline int Find(int x) { return anc[x] == x ? x : (anc[x] = Find(anc[x])); }
inline bool Union(int a, int b) {
  if ((a = Find(a)) == (b = Find(b))) return false;
  anc[a] = b;
  size[b] += size[a];
  return true;
}
inline int Pow(int base, int exp) {
  int res = 1;
  for (; exp; exp >>= 1) {
    if (exp & 1) res = (long long)res * base % MOD;
    base = (long long)base * base % MOD;
  }
  return res;
}
int cnt[N];
std::vector<int> pos;
std::vector<int> f[N], inv[N];
void DFS(int dep, int tot, int mx) {
  static std::vector<int> cur, g;
  if (dep == k) {
    if (mx < 3) {
      (++ans) %= MOD;
    } else {
      for (int i = 0; i < cur.size(); ++i) {
        tot = (long long)tot * inv[cnt[cur[i]]][cur[i]] % MOD;
        tot = (long long)tot * f[++cnt[cur[i]]][cur[i]] % MOD;
      }
      (ans += tot) %= MOD;
      for (int i = 0; i < cur.size(); ++i) --cnt[cur[i]];
    }
  } else {
    cur.push_back(size[pos[dep]]);
    g.push_back(1);
    DFS(dep + 1, tot, std::max(size[pos[dep]], mx));
    cur.pop_back();
    g.pop_back();
    for (int i = 0; i < cur.size(); ++i) {
      cur[i] += size[pos[dep]];
      ++g[i];
      DFS(dep + 1, (long long)tot * (g[i] - 1) % MOD, std::max(cur[i], mx));
      --g[i];
      cur[i] -= size[pos[dep]];
    }
  }
}
int main() {
  scanf("%d%d", &n, &k);
  static bool flag[N];
  static std::vector<int> val;
  static int order[N];
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    anc[i] = i;
    size[i] = 1;
    flag[a[i]] = true;
    if (!a[i]) pos.push_back(i);
  }
  for (int i = 0; i < k; ++i) order[pos[i]] = i;
  for (int i = 1; i <= n; ++i)
    if (!flag[i]) val.push_back(i);
  std::sort(val.begin(), val.end());
  for (int i = 1; i <= n; ++i)
    if (a[i] && !Union(i, a[i])) ++cnt[size[Find(i)]];
  int orig = 1, mx = 0;
  f[0].resize(n + 1, 1);
  inv[0].resize(n + 1, 1);
  for (int i = 1; i <= n; ++i) {
    f[i].resize(n / i + 1);
    inv[i].resize(n / i + 1);
    for (int j = 1; i * j <= n; ++j) {
      f[i][j] = (long long)j * f[i - 1][j] % MOD;
      if (i > 1) (f[i][j] += (long long)(i - 1) * j * f[i - 2][j] % MOD) %= MOD;
      inv[i][j] = Pow(f[i][j], MOD - 2);
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (cnt[i]) {
      mx = i;
      orig = (long long)orig * f[cnt[i]][i] % MOD;
    }
  }
  ans = 0;
  DFS(0, orig, mx);
  printf("%d\n", ans);
  return 0;
}
