#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int tens = 0;
int n, k;
int ans = 0;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    v.push_back(x % 10);
    tens += (x / 10);
  }
  sort(v.begin(), v.end());
  for (int i = v.size() - 1; i >= 0; i--)
    if (10 - v[i] <= k) {
      tens++;
      k -= (10 - v[i]);
    }
  int tenn = n * 10;
  tenn -= tens;
  if (k / 10 >= tenn)
    printf("%d\n", n * 10);
  else
    printf("%d\n", tens + (k / 10));
  return 0;
}
