#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[300][100] = {0}, ans;
  int n, m, i, j, k;
  string sos[200];
  char ch = 'A';
  cin >> n >> m;
  for (ch = 'A'; ch <= 'Z'; ch++) {
    for (i = 0; i < m; i++) a[ch - 'A'][i] = 0;
  }
  for (i = 0; i < n; i++) {
    cin >> sos[i];
  }
  for (j = 0; j < n; j++) a[sos[j][0] - 'A'][0] = 1;
  for (i = 1; i <= m - 1; i++) {
    for (j = 0; j < n; j++) {
      if (a[sos[j][i] - 'A'][i] == 0) {
        for (k = 0; k < 27; k++) {
          a[sos[j][i] - 'A'][i] += a[k][i - 1];
          a[sos[j][i] - 'A'][i] %= 1000000007;
        }
      }
    }
  }
  ans = 0;
  for (k = 0; k < 27; k++) {
    ans += a[k][m - 1];
    ans %= 1000000007;
  }
  cout << ans;
  return 0;
}
