#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int ans = 0;
  cin >> n >> k;
  vector<int> a(n);
  for (int(i) = (0); (i) < (n); (i)++) {
    cin >> a[i];
    ans += a[i] / 10;
    if (a[i] < 100) a[i] = 10 - a[i] % 10;
  }
  sort(a.begin(), a.end());
  for (int(i) = (0); (i) < (n); (i)++) {
    if (k < a[i] || a[i] == 100) break;
    k -= a[i];
    ans++;
  }
  cout << min(ans + k / 10, 10 * n) << endl;
  return 0;
}
