#include <bits/stdc++.h>
using namespace std;
int kol_v, kol_dn, ans, z, answer;
char a;
bool x = true, pr = true;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> kol_v >> kol_dn;
  for (int i = 0; i < kol_dn; i++) {
    pr = true;
    for (int l = 0; l < kol_v; l++) {
      cin >> a;
      if (a == '0') pr = false;
    }
    if (pr == false)
      ans++;
    else {
      if (ans != 0) {
        answer = max(answer, ans);
        ans = 0;
      }
    }
  }
  cout << max(answer, ans);
}
