#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
int main() {
  int n, m;
  cin >> n >> m;
  set<char> c[m];
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (int j = 0; j < m && j < s.size(); ++j) c[j].insert(s[j]);
  }
  long long int ans = 1;
  for (int i = 0; i < m; ++i) {
    ans = (ans * c[i].size()) % mod;
  }
  cout << ans << endl;
  return 0;
}
