#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) {
  if (a % 10 > b % 10) {
    return 1;
  } else
    return 0;
}
int main() {
  int n, m;
  cin >> n >> m;
  int sum = 0;
  int x[n], y[n];
  for (int i = 0; i < n; i++) cin >> x[i];
  sort(x, x + n, cmp);
  for (int i = 0; i < n; i++) {
    if (x[i] < 100 && m - (10 - (x[i] % 10)) >= 0) {
      m -= 10 - (x[i] % 10);
      x[i] -= x[i] % 10;
      x[i] += 10;
    } else {
      x[i] -= x[i] % 10;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 100; j > x[i]; j -= 10) {
      if (m - (j - x[i]) >= 0) {
        m -= (j - x[i]);
        x[i] = j;
      }
    }
  }
  sum = 0;
  for (int i = 0; i < n; i++) {
    sum += x[i] / 10;
  }
  cout << sum << endl;
}
