#include <bits/stdc++.h>
using namespace std;
long long n, m, k, k1, ans, tec, MAXN[1111111], h[111111], l, r;
string s, q;
bool f, used[1111];
vector<int> v;
int main() {
  cin >> m >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> s;
    r = l;
    for (int j = 0; j < s.size(); ++j) {
      if (s[j] == '0') {
        l++;
        break;
      }
    }
    if (l > r) {
      ans = max(ans, l);
    } else
      l = 0;
  }
  cout << ans;
}
