#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  long long n, m, i, j, k, ans = 1;
  cin >> n >> m;
  vector<string> v;
  string s;
  for (i = 0; i < n; ++i) {
    cin >> s;
    v.push_back(s);
  }
  for (i = 0; i < m; ++i) {
    unordered_map<char, long long> ma;
    for (j = 0; j < n; ++j) {
      ma[v[j][i]]++;
    }
    ans *= ma.size();
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
