#include <bits/stdc++.h>
using namespace std;
long long dp[205][6003], dp1[205][6003];
int main() {
  long long n, k;
  cin >> n >> k;
  long long tmp;
  for (int i = 0; i <= k; i++) {
    for (int j = 0; j <= 6000; j++) {
      dp1[i][j] = -2e9;
    }
  }
  dp1[0][0] = 0;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    int cnt2 = 0, cnt5 = 0;
    while (tmp % 2 == 0) {
      tmp /= 2;
      cnt2++;
    }
    while (tmp % 5 == 0) {
      tmp /= 5;
      cnt5++;
    }
    for (int l = 0; l <= k; l++) {
      for (int j = 0; j <= 6000; j++) {
        dp[l][j] = dp1[l][j];
        if (j - cnt5 >= 0 && l > 0)
          dp[l][j] = max(dp1[l - 1][j - cnt5] + cnt2, dp1[l][j]);
      }
    }
    for (int l = 0; l <= k; l++) {
      for (int j = 0; j <= 6000; j++) {
        dp1[l][j] = dp[l][j];
      }
    }
  }
  long long max1 = 0;
  for (long long j = 0; j <= 6000; j++) {
    max1 = max(min(dp[k][j], j), max1);
  }
  cout << max1 << endl;
}
