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