#include <bits/stdc++.h>
int Fibo(int n) {
  if (n == 0 || n == 1) {
    return 1;
  }
  return Fibo(n - 1) + Fibo(n - 2);
}
int main(void) {
  int n, m, i, j, ans = 1;
  int a[100000];
  scanf("%d%d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d", &a[i]);
  }
  ans *= Fibo(a[0] - 1);
  printf("%d * ", Fibo(a[0] - 1));
  for (i = 1; i < m; i++) {
    if (a[i] - a[i - 1] == 1) {
      ans = 0;
    }
    ans *= Fibo(a[i] - a[i - 1]);
    printf("%d * ", Fibo(a[i] - a[i - 1]));
  }
  ans *= Fibo(n - a[m - 1] - 1);
  printf("%d\n", Fibo(n - a[m - 1] - 1));
  printf("%d", ans % 1000000007);
  return 0;
}
