#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007LL;
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> name(n);
  for (int i = 0; i < (n); i++) {
    cin >> name[i];
  }
  long long res = 1LL;
  for (int j = 0; j < (m); j++) {
    set<char> C;
    C.clear();
    for (int i = 0; i < (n); i++) {
      C.insert(name[i][j]);
    }
    res *= (long long)C.size();
    res %= mod;
  }
  cout << res << endl;
  return 0;
}
