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