#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, x, arr[100][26] = {0};
  string s;
  while (cin >> a >> b) {
    while (a--) {
      cin >> s;
      for (int f = 0; f < s.length(); f++) {
        arr[f][s[f] - 'A'] = 1;
      }
    }
    long long ans = 1;
    for (int f = 0; f < b; f++) {
      x = 0;
      for (int f1 = 0; f1 < 26; f1++) x += arr[f][f1];
      ans = (ans * x) % 1000000007;
    }
    cout << ans << endl;
  }
}
