#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int nmax = (int)1e5 + 10;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  string s;
  vector<int> v;
  for (int i = (int)0; i <= (int)m - 1; i++) {
    cin >> s;
    bool win = false;
    for (int i = (int)0; i <= (int)s.size() - 1; i++) {
      if (s[i] == '0') {
        win = true;
        break;
      }
    }
    v.push_back(win);
  }
  int ans = 0;
  int sum = 0;
  for (int i = (int)0; i <= (int)v.size() - 1; i++) {
    sum += v[i];
    if (v[i] == 0) sum = 0;
    ans = max(ans, sum);
  }
  cout << ans << endl;
  return 0;
}
