#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  long long mod = 1e9 + 7;
  set<char> se[m];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      char r1;
      cin >> r1;
      se[j].insert(r1);
    }
  }
  long long ans = 1;
  for (long long i = 0; i < m; i++) {
    ans = (ans % mod * se[i].size() % mod) % mod;
  }
  cout << ans << endl;
}
