#include <bits/stdc++.h>
using namespace std;
int cmp(int x, int y) { return x % 10 > y % 10; }
int main() {
  int power[100005], n, k, i, sum = 0, num;
  scanf("%d%d", &n, &k);
  for (i = 0; i < n; ++i) {
    scanf("%d", &power[i]);
    sum += power[i] / 10;
  }
  sort(power, power + n, cmp);
  for (i = 0; i < n; ++i) {
    if (power[i] >= 100) continue;
    if (k < (10 - power[i] % 10)) {
      break;
    }
    if (k >= (10 - power[i] % 10)) {
      k -= (10 - power[i] % 10);
      power[i] += (10 - power[i] % 10);
      sum += 1;
    }
  }
  if (k != 0 && k >= 10) {
    for (i = 0; i < n && k >= 10; ++i) {
      if (power[i] < 100) {
        if (k > (100 - power[i])) {
          k -= (100 - power[i]);
          sum += (100 - power[i]) / 10;
        } else {
          sum += k / 10;
          k = 0;
        }
      }
    }
  }
  printf("%d\n", sum);
}
