#include <bits/stdc++.h>
using namespace std;
const long long N = 210;
long long dp[N * 26][N];
signed main() {
  memset(dp, 0x80, sizeof dp);
  dp[0][0] = 0;
  long long n, K;
  cin >> n >> K;
  long long t5 = 0;
  for (long long i = 1; i <= n; i++) {
    long long p2 = 0, p5 = 0, x;
    cin >> x;
    while (x % 2 == 0) {
      x /= 2;
      p2++;
    }
    while (x % 5 == 0) {
      x /= 5;
      p5++;
    }
    t5 += p5;
    for (long long k = min(i, K); k >= 1; k--)
      for (long long j = t5; j >= p5; j--) {
        dp[j][k] = max(dp[j][k], dp[j - p5][k - 1] + p2);
      }
  }
  long long ans = 0;
  for (long long i = 0; i <= t5; i++) ans = max(ans, min(i, dp[i][K]));
  cout << ans << "\n";
}
