#include <bits/stdc++.h>
using namespace std;
int diff[100010], a[100010];
int main() {
  long long ans = 0, ct = 0, i, n, k;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if ((a[i] % 10) != 0) {
      diff[i] = (a[i] / 10 + 1) * 10 - a[i];
    }
    ans += a[i] / 10;
    ct += 100 - a[i];
  }
  sort(diff, diff + n);
  for (i = 0; i < n; i++) {
    if (diff[i] != 0) {
      k -= diff[i];
      if (k >= 0) {
        ans += 1;
        ct -= diff[i];
      } else
        break;
    }
  }
  if (k >= ct) {
    ans += ct / 10;
  } else
    ans += k / 10;
  cout << ans << endl;
  return 0;
}
