#include <bits/stdc++.h>
using namespace std;
const int inf = 100000005;
map<int, int> freq;
bool cmp(int &x, int &y) { return (10 - x % 10) > (10 - y % 10) ? 1 : 0; }
int charr[100001];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> charr[i];
  }
  sort(charr, charr + n, cmp);
  int ns = 0;
  int tt = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (k == 0) break;
    if (charr[i] != 100) {
      int temp = 10 - charr[i] % 10;
      if (k >= temp) {
        charr[i] = charr[i] + temp;
        k -= temp;
      } else
        break;
    }
  }
  sort(charr, charr + n);
  for (int i = 0; i < n; i++) {
    int temp = 100 - charr[i];
    if (k >= (temp)) {
      charr[i] = 100;
      k -= temp;
    } else {
      k = k - k % 10;
      charr[i] += k;
      break;
    }
  }
  ns = 0;
  for (int i = 0; i < n; i++) {
    ns += charr[i] / 10;
  }
  cout << ns;
  return 0;
}
