#include <bits/stdc++.h>
using namespace std;
const int N = 100500;
int a[N], b[N], ans, k, n;
void out() { cout << ans; }
int main() {
  srand(time(NULL));
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    ans += a[i] / 10;
    if (a[i] == 100) {
      b[i] = 10;
      continue;
    }
    b[i] = a[i] % 10;
  }
  sort(b + 1, b + 1 + n);
  for (int i = n; i >= 1; i--) {
    if (b[i] == 10) {
      continue;
    }
    if (k - (10 - b[i]) >= 0) {
      k -= (10 - b[i]);
      ans++;
      b[i] = 0;
    }
    if (!k) {
      break;
    }
  }
  int sum = 0;
  if (k && ans != 10 * n) {
    sum = 10 * n - ans;
    k /= 10;
    if (sum <= k) {
      ans = 10 * n;
    } else {
      ans += k;
    }
  }
  out();
  return 0;
}
