(defun memo (fn)
    (declare (type function fn))
    (let ((table (make-hash-table :test 'equal)))
        #'(lambda (&rest rest)
              (multiple-value-bind (val found-p) (gethash rest table)
                  (if found-p
                      val
                      (setf (gethash rest table) (apply fn rest)))))))

(defun memoize (fn-name)
    (declare (type symbol fn-name))
    (setf (symbol-function fn-name) (memo (symbol-function fn-name))))

(defmacro defun-memo (fn args &body body)
    `(memoize (defun ,fn ,args . ,body)))

(defvar *mod* 1000000007)
(defparameter *unuse-lst* '())

(defun-memo find-element (elem)
    (declare (type fixnum elem))
    (not (null (find elem *unuse-lst*))))

(defun-memo rec (goal now)
    (declare (type fixnum goal now))
    (cond ((eq goal now) 1)
        ((< goal now) 0)
        ((find-element now) 0)
        (t (+ (rec goal (+ 1 now))
               (rec goal (+ 2 now))))))

(defun solve (goal)
    (declare (type fixnum goal))
    (let ((result (the number (rec goal 0))))
        (print (rem result *mod*))))

(let ((goal (read))
         (num (read)))
    (dotimes (i num)
        (push (read) *unuse-lst*))
    (solve goal))
