#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long infLL = 0x3f3f3f3f3f3f3f3fLL;
const int maxn = 100000 + 5;
int n, k;
int a[maxn];
bool cmp(int a, int b) { return a % 10 > b % 10; }
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < (n); ++i) scanf("%d", &a[i]);
  sort(a, a + n, cmp);
  for (int i = 0; i < (n); ++i)
    if (a[i] % 10) {
      if (k < 10 - a[i] % 10) break;
      k -= 10 - a[i] % 10;
      a[i] = (a[i] / 10 + 1) * 10;
    }
  if (k) {
    for (int i = 0; i < (n); ++i)
      if (a[i] < 100) {
        if (k < 100 - a[i]) {
          a[i] += k;
          break;
        }
        k -= 100 - a[i];
        a[i] = 100;
      }
  }
  int ret = 0;
  for (int i = 0; i < (n); ++i) ret += a[i] / 10;
  printf("%d\n", ret);
  return 0;
}
