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