#include <bits/stdc++.h>
using namespace std;
int roundUp(int numToRound, int multiple) {
  if (multiple == 0) return numToRound;
  int remainder = numToRound % multiple;
  if (remainder == 0) return numToRound;
  return numToRound + multiple - remainder;
}
int main() {
  int32_t n, k;
  cin >> n >> k;
  int16_t a[100000];
  for (int32_t i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n, [](int16_t a, int16_t b) {
    return roundUp(a, 10) - a < roundUp(b, 10) - b;
  });
  for (int32_t i = 0; i < n; i++) {
    if (k == 0) {
      break;
    }
    auto min_a = min(k, roundUp(a[i], 10) - a[i]);
    k -= min_a;
    a[i] += min_a;
  }
  if (k > 0) {
    for (int32_t i = 0; i < n; i++) {
      if (k < 10) {
        break;
      }
      auto min_a = min(k, 100 - a[i]);
      k -= min_a;
      a[i] += min_a;
    }
  }
  cout << accumulate(a, a + n, 0, [](int32_t a, int32_t b) {
    return a + b / 10;
  }) << endl;
}
