#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
typedef struct {
  int32_t a;
  int32_t b;
} hw;
typedef struct {
  int64_t a;
  int64_t b;
} hwll;
typedef struct {
  int64_t a;
  int64_t b;
  int64_t c;
} hwllc;
typedef struct {
  hwll a;
  hwll b;
} linell;
uint64_t n, m;
uint64_t h, w;
uint64_t k;
uint64_t q;
int64_t va, vb, vc, vd, ve, vf;
uint64_t ua, ub, uc, ud, ue, uf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
char ch, dh;
uint64_t umin(uint64_t x, uint64_t y) { return (x < y) ? x : y; }
uint64_t umax(uint64_t x, uint64_t y) { return (x > y) ? x : y; }
int64_t smin(int64_t x, int64_t y) { return (x < y) ? x : y; }
int64_t smax(int64_t x, int64_t y) { return (x > y) ? x : y; }
uint64_t gcd(uint64_t x, uint64_t y) {
  if (x < y) {
    return gcd(y, x);
  } else if (y == 0) {
    return x;
  } else {
    return gcd(y, x % y);
  }
}
uint64_t bitpow(uint64_t a, uint64_t x, uint64_t modulo) {
  uint64_t result = 1;
  while (x) {
    if (x & 1) {
      result *= a;
      result %= modulo;
    }
    x /= 2;
    a = (a * a) % modulo;
  }
  return result;
}
uint64_t divide(uint64_t a, uint64_t b, uint64_t modulo) {
  return (a * bitpow(b, modulo - 2, modulo)) % modulo;
}
uint64_t udiff(uint64_t a, uint64_t b) {
  if (a >= b) {
    return a - b;
  } else {
    return b - a;
  }
}
int64_t sdiff(int64_t a, int64_t b) {
  if (a >= b) {
    return a - b;
  } else {
    return b - a;
  }
}
int bitcount(uint64_t n) {
  int result = 0;
  while (n) {
    if (n & 1) result++;
    n /= 2;
  }
  return result;
}
int32_t pullcomp(const void *left, const void *right) {
  uint64_t l = *(uint64_t *)left, r = *(uint64_t *)right;
  if ((l) < (r)) return -1;
  if ((l) > (r)) return +1;
  return 0;
}
int32_t prevcomp(const void *left, const void *right) {
  uint64_t l = *(uint64_t *)left, r = *(uint64_t *)right;
  if ((r) < (l)) return -1;
  if ((r) > (l)) return +1;
  return 0;
}
int32_t psllcomp(const void *left, const void *right) {
  int64_t l = *(int64_t *)left, r = *(int64_t *)right;
  if ((l) < (r)) return -1;
  if ((l) > (r)) return +1;
  return 0;
}
int32_t pcharcomp(const void *left, const void *right) {
  char l = *(char *)left, r = *(char *)right;
  if ((l) < (r)) return -1;
  if ((l) > (r)) return +1;
  return 0;
}
int32_t pdoublecomp(const void *left, const void *right) {
  double l = *(double *)left, r = *(double *)right;
  if ((l) < (r)) return -1;
  if ((l) > (r)) return +1;
  return 0;
}
int32_t pstrcomp(const void *left, const void *right) {
  char *l = *(char **)left;
  char *r = *(char **)right;
  return strcmp(l, r);
}
int32_t phwllABcomp(const void *left, const void *right) {
  hwll l = *(hwll *)left, r = *(hwll *)right;
  if ((l.a) < (r.a)) return -1;
  if ((l.a) > (r.a)) return +1;
  if ((l.b) < (r.b)) return -1;
  if ((l.b) > (r.b)) return +1;
  return 0;
}
int32_t phwllREVcomp(const void *left, const void *right) {
  hwll l = *(hwll *)left, r = *(hwll *)right;
  if ((l.b) < (r.b)) return -1;
  if ((l.b) > (r.b)) return +1;
  if ((l.a) < (r.a)) return -1;
  if ((l.a) > (r.a)) return +1;
  return 0;
}
int32_t ptriplecomp(const void *left, const void *right) {
  hwllc l = *(hwllc *)left, r = *(hwllc *)right;
  if ((l.a) < (r.a)) return -1;
  if ((l.a) > (r.a)) return +1;
  if ((l.b) < (r.b)) return -1;
  if ((l.b) > (r.b)) return +1;
  if ((l.c) < (r.c)) return -1;
  if ((l.c) > (r.c)) return +1;
  return 0;
}
int32_t ptripleREVcomp(const void *left, const void *right) {
  hwllc l = *(hwllc *)left, r = *(hwllc *)right;
  if ((l.b) < (r.b)) return -1;
  if ((l.b) > (r.b)) return +1;
  if ((l.a) < (r.a)) return -1;
  if ((l.a) > (r.a)) return +1;
  if ((l.c) < (r.c)) return -1;
  if ((l.c) > (r.c)) return +1;
  return 0;
}
int32_t pquadcomp(const void *left, const void *right) {
  linell l = *(linell *)left;
  linell r = *(linell *)right;
  int64_t ac = phwllABcomp(&(l.a), &(r.a));
  if (ac) return ac;
  int64_t bc = phwllABcomp(&(l.b), &(r.b));
  if (bc) return bc;
  return 0;
}
bool isinrange(int64_t left, int64_t x, int64_t right) {
  return (left <= x && x <= right);
}
bool isinrange_soft(int64_t left, int64_t x, int64_t right) {
  return (left <= x && x <= right) || (left >= x && x >= right);
}
int64_t a[1000000 + 5];
int64_t b[1000000 + 5];
int64_t c[1000000 + 5];
int64_t d[1000000 + 5];
char s[1000000 + 1];
char t[1000000 + 1];
hwll xy[1000000];
hwllc tup[1000000];
int64_t table[3000][3000];
uint64_t gin[1000000];
const uint64_t inv2 = 500000004LL;
uint64_t dp[2000][2000][2][5];
uint64_t dfs(uint64_t v) {
  uint64_t tmp[2000][2][5];
  dp[v][0][0][0] = 1;
  uint64_t left = 1;
  for (uint64_t i = gin[v]; i < gin[v + 1]; i++) {
    uint64_t u = xy[i].b;
    uint64_t right = dfs(u);
    fflush(stdout);
    for (int64_t j = 0; j < left + right; j++) {
      for (int64_t k = 0; k < 2; k++) {
        for (int64_t l = 0; l < 5; l++) {
          tmp[j][k][l] = 0;
        }
      }
    }
    for (int64_t jl = 0; jl < left; jl++) {
      for (int64_t jr = 0; jr < right; jr++) {
        int64_t j = jl + jr;
        for (uint64_t kl = 0; kl < 2; kl++) {
          for (uint64_t kr = 0; kr < 2; kr++) {
            uint64_t k = kl ^ kr;
            uint64_t l0 = dp[v][jl][kl][0];
            uint64_t l1 = dp[v][jl][kl][1];
            uint64_t l2 = dp[v][jl][kl][2];
            uint64_t l3 = dp[v][jl][kl][3];
            uint64_t l4 = dp[v][jl][kl][4];
            uint64_t r0 = dp[u][jr][kr][0];
            uint64_t r1 = dp[u][jr][kr][1];
            uint64_t r2 = dp[u][jr][kr][2];
            tmp[j + 1][k][0] += l0 * (r0 + r1 + r2) % 1000000007;
            tmp[j + 1][k][0] %= 1000000007;
            tmp[j][k ^ 1][1] += (l0 * r0 % 1000000007) * 2;
            tmp[j][k ^ 1][1] %= 1000000007;
            tmp[j][k][1] += l0 * (r1) % 1000000007;
            tmp[j][k][1] %= 1000000007;
            tmp[j][k][3] += l0 * r0 % 1000000007;
            tmp[j][k][3] %= 1000000007;
            tmp[j][k][4] += l0 * (r1) % 1000000007;
            tmp[j][k][4] %= 1000000007;
            tmp[j + 1][k][1] += l1 * (r0 + r1 + r2) % 1000000007;
            tmp[j + 1][k][1] %= 1000000007;
            tmp[j + 1][k][2] += l2 * (r0 + r1 + r2) % 1000000007;
            tmp[j + 1][k][2] %= 1000000007;
            tmp[j + 1][k][3] += l3 * (r0 + r1 + r2) % 1000000007;
            tmp[j + 1][k][3] %= 1000000007;
            tmp[j][k ^ 1][2] += (l3 * r0 % 1000000007) * 2;
            tmp[j][k ^ 1][2] %= 1000000007;
            tmp[j][k][2] += l3 * r1 % 1000000007;
            tmp[j][k][2] %= 1000000007;
            tmp[j + 1][k][4] += l4 * (r0 + r1 + r2) % 1000000007;
            tmp[j + 1][k][4] %= 1000000007;
            tmp[j][k][2] += l4 * r0 % 1000000007;
            tmp[j][k][2] %= 1000000007;
            tmp[j][k ^ 1][2] += (l4 * r1 % 1000000007) * inv2 % 1000000007;
            tmp[j][k ^ 1][2] %= 1000000007;
          }
        }
      }
    }
    left += right;
    for (int64_t j = 0; j < left; j++) {
      for (int64_t k = 0; k < 2; k++) {
        for (int64_t l = 0; l < 5; l++) {
          dp[v][j][k][l] = tmp[j][k][l];
        }
      }
    }
  }
  fflush(stdout);
  return left;
}
uint64_t solve() {
  int64_t i, j, ki, li;
  int64_t result = 0;
  double dresult = 0;
  int64_t maybe = 0;
  int64_t sum = 0;
  int64_t item;
  uint64_t *dpcell;
  for (i = 1; i < n; i++) {
    xy[i - 1] = (hwll){a[i], i};
  }
  qsort(xy, n - 1, sizeof(hwll), phwllABcomp);
  i = j = 0;
  while (i < n) {
    gin[i] = j;
    while (j < n - 1 && xy[j].a == i) j++;
    i++;
  }
  gin[i] = j;
  dfs(0);
  uint64_t frac = 1;
  for (j = 0; j < n; j++) {
    frac *= (j + 1);
    frac %= 1000000007;
    uint64_t item = 0;
    for (ki = 0; ki < 2; ki++) {
      for (li = 0; li < 3; li++) {
        item = (item + dp[0][j][ki][li]) % 1000000007;
      }
    }
    item = (item * frac) % 1000000007;
    if ((n - 1 - j) % 2) {
      result = (result + 1000000007 - item) % 1000000007;
    } else {
      result = (result + item) % 1000000007;
    }
  }
  printf("%lld\n", result);
  return 0;
success:
  printf("%llu\n", result);
  return 0;
fail:
  puts("0");
  return 1;
}
int32_t main(void) {
  int32_t i, j;
  int32_t x, y;
  scanf("%llu", &n, &m);
  for (i = 1; i < n; i++) {
    scanf("%lld", &a[i]);
    a[i]--;
  }
  solve();
  return 0;
}
