#include <bits/stdc++.h>
using namespace std;
inline bool isvowel(char c) {
  return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
}
template <class T>
void print(const T &cont) {
  for (auto x : cont) {
    cout << x << ' ';
  }
  cout << '\n';
}
const long long mod = 1e9 + 7;
void input() {
  int n, m;
  cin >> n >> m;
  vector<string> v(n);
  for (auto &x : v) cin >> x;
  vector<long long> keys(m);
  for (int j = 0; j < (m); j++) {
    set<char> s;
    for (int i = 0; i < (n); i++) {
      s.insert(v[i][j]);
    }
    keys[j] = s.size();
  }
  long long ans = 1;
  for (auto k : keys) {
    ans = (ans * k) % mod;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    input();
  }
}
