#include <bits/stdc++.h>
using namespace std;
int mass[100001];
bool compare(int a, int b) {
  if (a % 10 <= b % 10)
    return false;
  else
    return true;
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> mass[i];
  sort(mass, mass + n, compare);
  int j = 0;
  while (k > 0 && j < n) {
    if (mass[j] >= 100) {
      j++;
      continue;
    }
    if (k >= 10 - mass[j] % 10) {
      int a = 10 - mass[j] % 10;
      mass[j] += a;
      k -= a;
    } else {
      mass[j] += k;
      k = 0;
      break;
    }
    j++;
  }
  for (int i = 0; i < n; i++) {
    if (mass[i] + k == 100) {
      mass[i] += k;
      break;
    }
    if (mass[i] + k > 100) {
      int a = 100 - mass[i];
      mass[i] += a;
      k -= a;
      continue;
    }
    if (mass[i] + k < 100) {
      mass[i] += k;
      break;
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += mass[i] / 10;
  }
  cout << sum;
  return 0;
}
