#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  long long n, d;
  cin >> n >> d;
  string s;
  long long l = 0, ans = 0;
  while (d--) {
    cin >> s;
    bool beat = false;
    for (char ch : s)
      if (ch == '0') beat = true;
    if (beat)
      l++;
    else
      l = 0;
    ans = max(ans, l);
  }
  cout << ans << '\n';
  return 0;
}
