#include <bits/stdc++.h>
using namespace std;
bool is_any_abs(string s) {
  for (char i : s) {
    if (i == '0') return true;
  }
  return false;
}
int main() {
  int n, d;
  cin >> n >> d;
  string s;
  int ans = 0, cur = 0;
  while (d--) {
    cin >> s;
    if (is_any_abs(s))
      cur++;
    else {
      ans = max(ans, cur);
      cur = 0;
    }
  }
  ans = max(ans, cur);
  cout << ans;
}
